package org.gongliang.jsmile.authc.mq;


import org.gongliang.jsmile.common.base.BaseController;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 
 * @author Morily
 *
 */
@Controller
public class KafkaController extends BaseController {


	private KafkaTemplate<String, String> KafkaTemplate;
	/**
	 * 首页面
	 * @throws InterruptedException 
	 */
	@RequestMapping(value = "/kafka")
	@ResponseBody
	public String send() throws InterruptedException {
		for (int i = 0; i < 10; i++) {
			Thread.sleep(500);
			KafkaTemplate.send(KafkaConstants.LOGS_TOPIC,"hello world!");
		}
		return "send";
	}

}
